<?php

namespace app\user\model\goods;

use think\Model;

/**
 * Brand
 */
class Collection extends Model
{
    // 表名
    protected $name = 'goods_collection';

    // 自动写入时间戳字段
    protected $autoWriteTimestamp = true;

    public function brand(){
        return $this->hasOneThrough(Brand::class, Goods::class, 'id', 'id', 'goods_id', 'goods_brand_id');
    }

    public function goods(){
        return $this->hasOne(Goods::class, 'id', 'goods_id');
    }

    public function specs(){
        return $this->hasMany(GoodsSpecs::class, 'goods_id', 'goods_id');
    }

}